package org.blogsite.greencode.service.impl;

import java.util.List;

import org.blogsite.greencode.bean.SystemBulletinBoard;
import org.blogsite.greencode.bean.User;
import org.blogsite.greencode.dao.SystemDAO;
import org.blogsite.greencode.service.SystemService;

public class SystemServiceImpl implements SystemService {
	
	private SystemDAO systemDao;

	public SystemDAO getSystemDao() {
		return systemDao;
	}
	public void setSystemDao(SystemDAO systemDao) {
		this.systemDao = systemDao;
	}
	
	/*验证注册信息是否正确*/
	public boolean checkRegisterInfo(String name, String job_num) {
		return systemDao.checkRegisterInfo(name, job_num);
	}
	/*注册保存用户信息*/
	public void save(User user) {
		systemDao.save(user);
	}
	/*验证用户名是否可用*/
	public boolean checkUsername(String username){
		return systemDao.checkUsername(username);
	}
	/*验证登录*/
	public User checkLogin(User user){
		return systemDao.checkLogin(user);
	}
	/*当登录验证成功,修改最后登录与最后IP*/
	public void updateLastDateAndIP(User user){
		systemDao.updateLastDateAndIP(user);
	}
	/*查询用户个人信息*/
	public User searchPersonInformation(String userName){
		return systemDao.searchPersonInformation(userName);
	}
	/*添加公告板信息*/
	public void addBulletinBoard(SystemBulletinBoard systemBulletinBoard){
		systemDao.addBulletinBoard(systemBulletinBoard);
	}
	/*修改用户密码*/
	public void modifyPassword(User user){
		systemDao.modifyPassword(user);
	}
	/*返回用户对象*/
	public User getUser(String name){
		return systemDao.getUser(name);
	}
	/*jasypt开源项目为密码加密,*/
	public String encryptPassword(String password){
		return systemDao.encryptPassword(password);
	}
	/*jasypt检查密码合法性*/
	public boolean checkPassword(String plainPassword,String encryptedPassword){
		return systemDao.checkPassword(plainPassword, encryptedPassword);
	}
	/*显示所有公告*/
	public List displayAllBulletin(){
		return systemDao.displayAllBulletin();
	}
	/*查询公告*/
	public void deleteBulletin(SystemBulletinBoard sysBoard){
		systemDao.deleteBulletin(sysBoard);
	}
	/*显示公告详细内容*/
	public SystemBulletinBoard showDetailBulletinBoard(int id){
		
		return systemDao.showDetailBulletinBoard(id);
	}

}
